package com.lmm.rpc.core.client.protocol;

import lombok.Getter;

/**
 * 消息类型
 * */
public enum MessageType {
    REQUEST((byte) 1),
    RESPONSE((byte) 2),
    HEARTBEAT((byte) 3);

    @Getter
    private byte type;

    MessageType(byte type) {
        this.type = type;
    }

    public static MessageType findByType(byte type) {
        for (MessageType msgType : MessageType.values()) {
            if (msgType.getType() == type) {
                return msgType;
            }
        }
        return null;
    }
}
